/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bols;

import entity.User2;
import facade.User2FacadeRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author lab1
 */
public class BOLLogin {

    User2FacadeRemote user2Facade = lookupUser2FacadeRemote();

    private User2FacadeRemote lookupUser2FacadeRemote() {
        try {
            Context c = new InitialContext();
            return (User2FacadeRemote) c.lookup("java:global/SHOPPINGCART2/SHOPPINGCART2-ejb/User2Facade!facade.User2FacadeRemote");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
    //dung de check username va password khi nguoi dung login
    public boolean checkLogin(User2 us) {
        boolean u = user2Facade.login(us);
        return u;
    }
}
